//
//  orderListsViewController.m
//  HAODE
//
//  Created by panquanReabam.com on 15/9/26.
//  Copyright (c) 2015年 reabam.com. All rights reserved.
//

#import "BusinessWhsOutListViewController.h"
#import "OrderDetailViewController.h"
#import "HAODEsingleton.h"
#import "UIViewExt.h"
#import "HttpRequest.h"
#import "JSONKit.h"
#import "InstallConfirmViewController.h"
#import "huiyuandengjiViewController.h"
#import "UIImageView+WebCache.h"
#import "shouyingViewController.h"
#import "RDVTabBarController.h"
#import "MJRefresh.h"
#import "sxview.h"
#import "orderListCell.h"
#import "huiyuanDetailsViewController.h"
#import "ToResiduePayViewController.h"
#import "ShopcatListViewController.h"
#import "TheLoginViewController.h"
#import "DeliveryConfirmViewController.h"
#import "PlaceOrderViewController.h"
#import "BusinessWhsOutDetailViewController.h"
@interface BusinessWhsOutListViewController ()<MBProgressHUDDelegate,UIGestureRecognizerDelegate,UINavigationControllerDelegate,UITextFieldDelegate,UISearchBarDelegate>
@property (strong, nonatomic) NSString *areaValue;
@property (strong, nonatomic) NSString*cityValue;
@property (retain, nonatomic)NSString*sats;
@property (retain, nonatomic)NSString*orderSort;
@property(nonatomic,retain)UIDatePicker* da;
@end

@implementation BusinessWhsOutListViewController

{
    UISearchBar *search;
    HAODEsingleton* commdity;
    MJRefreshHeaderView* _header;
    MJRefreshFooterView* _footer;
    
    NSMutableArray*createName;
    NSMutableArray*itemTypes;
    NSMutableArray*whsOutDate;
    NSMutableArray*whsOutId;
    NSMutableArray*whsOutNo;
    NSMutableArray*whsOutStatus;
    NSMutableArray*whsOutTypeName;
    NSMutableArray* whsOutTypeCode;
    NSMutableArray* whsOutStatusName;
    NSMutableArray* totalQuantity;
    NSMutableArray* whsName;
    NSMutableArray*totalMoney;
    BOOL saveAccount;
    BOOL saveAccount1;
    NSString *result;
    int pageNumber;
    MBProgressHUD *progressHud;
    UIView* backview1;
    UIScrollView*myscrollView;
    NSString* sous;
    int pageNumber1;
    int pageNumber2;
    NSString*meiyousuos;
    UIView*view3;
    UITextField*searchTextField;
    UITextField*telTextFied;
    UITextField*zbsTextFied;
    UITextField*zbsTextFied1;
    UITextField*gjzFied;
    UITextField*Salary1;
    UITextField*WorkExper1;
    UIView *view1;
    UIView *view2;
    UIButton*sat;
    UIButton*sat1;
    UIButton*btn2;
    UIView*myToolBar1;
    UIButton* sxBtn;
    UIButton*jiazai;
    float lastContentOffset;
    UIButton*i22;
    UIButton*i1;
    UIButton*i12;
    UIButton*jiantouNormal;
    NSString*TotalCount;
    NSMutableArray* earnestMoney;
    
    
    NSMutableArray*typeName;
    NSMutableArray*typeCode;
    NSMutableArray*isSingle;
    NSMutableArray*congzhicurrent;
    NSMutableArray*current;
    NSMutableArray*dataType;
    NSMutableArray *searchBeans;
    NSMutableArray*itemValue;
    NSMutableArray*itemName;
    NSMutableArray*items;
    UITextField*openTimeTextFied;
    UITextField*closeTimeTextFied;
    sxview*daogouView;
    UIView*view;
    UITableView *table_list;
    UIScrollView*mainScroll;
    NSMutableArray* arrrss;
    UIButton*shaixuanBtn;
    
    
    NSString*baioqianshuju;
    UITableView *biaoqiantable_list;
    NSMutableArray* biaoqianarrrss;
    NSMutableArray* biaoqianitemValue;
    NSMutableArray *selectitemNameArray;
    NSMutableArray *selectitemValueArray;
    NSMutableArray *isCustom;
    NSMutableArray *isRange;
    NSMutableArray *biaoqianxuanzhong;
    NSString* zhongzhisx;
    
}
@synthesize alt = alt;

-(void)BackAction:(UIButton *)sender{
    
    
    [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];
    
    
    
}
- (void)viewDidDisappear:(BOOL)animated

{
    
    [super viewDidDisappear:animated];
    
    
    
    self.navigationController.delegate = nil;
    
}
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    // 禁用 iOS7 返回手势
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    NSLog(@"tttt");
    [[self rdv_tabBarController] setTabBarHidden:YES];
    self.navigationController.navigationBarHidden=NO;
        self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
    UILabel *lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 43,ScreenWidth, 1)];
    [lineLabel setBackgroundColor:[UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]];
    [self.navigationController.navigationBar addSubview:lineLabel];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBarTintColor:Color];
    
    UIImage* backImage = [UIImage imageNamed:@"fanhui"];
    CGRect backframe = CGRectMake(0,0,30,30);
    UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
    [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
    backButton.titleLabel.textAlignment=NSTextAlignmentLeft;
    [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    self.navigationController.delegate = self;

    
    [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
    
    self.title=@"出库";
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                     [UIColor blackColor],
                                                                     UITextAttributeTextColor,
                                                                     [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1],
                                                                     UITextAttributeTextShadowColor,
                                                                     [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
                                                                     UITextAttributeTextShadowOffset,
                                                                     [UIFont fontWithName:@"Helvetica Neue" size:tetlefot],
                                                                     UITextAttributeFont,nil]];
    
    
    [self add];
    
    // 手势
    UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyBoad)];
    singleFingerOne.numberOfTouchesRequired = 1; //手指数
    singleFingerOne.numberOfTapsRequired = 1; //tap次数
    singleFingerOne.delegate = self;
    [myscrollView addGestureRecognizer:singleFingerOne];
    
    UIView* myToolBar=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, viewheight)];
    myToolBar.backgroundColor=jianpancolor;
    UIButton*  tubtnDone=[[UIButton alloc]initWithFrame:CGRectMake(logoX,logoY, logoheight, logowidth)];
    [tubtnDone setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    [tubtnDone addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:tubtnDone];
    UIButton*btnDone111=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width - 55, 12, 40, 16)];
    [btnDone111 setTitle:@"确定" forState:UIControlStateNormal];
    [btnDone111 setTitleColor:jianpancolor1 forState:UIControlStateNormal];
    btnDone111 .titleLabel .font=[UIFont systemFontOfSize:daxiao];
    [btnDone111 addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:btnDone111];
    myToolBar.alpha=alp;
    UIButton* dabtn=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width-60, 0, 60, 40)];
    [dabtn addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:dabtn];
    searchTextField.inputAccessoryView = myToolBar;
    
    UIButton*tianjiaBtn = [[UIButton alloc] initWithFrame:CGRectMake(30, 0.0,  60/2, 60/2)];
    [tianjiaBtn setImage:[UIImage imageNamed:@"tianjia"] forState:UIControlStateNormal];
    [tianjiaBtn addTarget:self action:@selector(addProduct:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* myBtnBtn = [[UIBarButtonItem alloc] initWithCustomView:tianjiaBtn];
    self.navigationItem.rightBarButtonItem = myBtnBtn;
    
}

-(void)OnTapDone{
    
    [searchTextField resignFirstResponder];
    
    [self add];
    
    
}

-(void)addProduct:(UIButton*)sender{
    
    commdity.gengxin=@"WhsOut";
    PlaceOrderViewController *detailViewController = [[PlaceOrderViewController alloc] init];
    detailViewController.ptype=@"saleItem";
    detailViewController.Whs=@"WhsOut";
    //    detailViewController.saveTypeStr=@"WHSOUT";
    [self.navigationController pushViewController:detailViewController animated:YES];
    
    
}


- (void)viewDidLoad
{
    
    [super viewDidLoad];
    saveAccount1=NO;
    [self addFooter];
    
    [self addheader];
    
    self.sats=@"newShelf";
    _orderSort=@"desc";
    
    typeCode=[[NSMutableArray alloc]init];
    typeName=[[NSMutableArray alloc]init];
    items=[[NSMutableArray alloc]init];
    isSingle=[[NSMutableArray alloc]init];
    current=[[NSMutableArray alloc]init];
    congzhicurrent=[[NSMutableArray alloc]init];
    dataType=[[NSMutableArray alloc]init];
    selectitemNameArray=[[NSMutableArray alloc]init];
    selectitemValueArray=[[NSMutableArray alloc]init];
    
    commdity=[HAODEsingleton shared];
    commdity.opentime=nil;
    commdity.closeTime=nil;
    commdity.content3=@"";
    
    UIView*view11=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth,80/2)];
    view11.backgroundColor= zuiqianhuicolor;
    
    _table.delegate=self;
    _table.dataSource=self;
    _table.separatorStyle=UITableViewCellSeparatorStyleNone;
    _table.tableHeaderView=view11;
    
    
    sat=[[UIButton alloc]initWithFrame:CGRectMake(18, 0, ScreenWidth/3, 40)];
    [sat setTitle:@"最新" forState:UIControlStateNormal];
    [sat setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    sat.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
    sat.titleLabel.font=[UIFont systemFontOfSize:14];
    [sat addTarget:self action:@selector(sat:) forControlEvents:UIControlEventTouchUpInside];
    [view11 addSubview:sat];
    
    sat1=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth/3-7, 0, ScreenWidth/3, 40)];
    [sat1 setTitle:@"金额     " forState:UIControlStateNormal];
    [sat1 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    sat1.titleLabel.font=[UIFont systemFontOfSize:14];
    [sat1 addTarget:self action:@selector(sat1:) forControlEvents:UIControlEventTouchUpInside];
    sat1.titleLabel.textAlignment=NSTextAlignmentCenter;
    [view11 addSubview:sat1];
    
    
    
    jiantouNormal=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth/2+10, 15, 10, 10)];
    [jiantouNormal setImage:[UIImage imageNamed:@"jiantou_normal"] forState:UIControlStateNormal];
    [jiantouNormal addTarget:self action:@selector(sat1:) forControlEvents:UIControlEventTouchUpInside];
    [view11 addSubview:jiantouNormal];
    
    shaixuanBtn=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth-78,  0, 60,40)];
    [shaixuanBtn.layer setCornerRadius:2.0];
    [shaixuanBtn.layer setBorderWidth:0];
    [shaixuanBtn.layer setMasksToBounds:YES];
    [shaixuanBtn addTarget:self action:@selector(sxuan:) forControlEvents:UIControlEventTouchUpInside];
    CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
    CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){153/255.0,153/255.0, 153/255.0, 1.0   });
    [shaixuanBtn.layer setBorderColor:colorref2];//边框颜色
    [shaixuanBtn setTitle:@"筛选" forState:UIControlStateNormal];
    shaixuanBtn.titleLabel.font=[UIFont systemFontOfSize:14];
    [shaixuanBtn setTitleColor:shenhuicolor forState:UIControlStateNormal];
    shaixuanBtn.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
    [view11 addSubview:shaixuanBtn];
    
    sxBtn = [[UIButton alloc] initWithFrame:CGRectMake(3.5,5, 30, 30)];
    [sxBtn setImage:[UIImage imageNamed:@"shaixuan"] forState:UIControlStateNormal];
    [sxBtn addTarget:self action:@selector(sxuan:) forControlEvents:UIControlEventTouchUpInside];
    [shaixuanBtn addSubview:sxBtn];
    
    
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    [param setValue:@"whsOut" forKey:@"filterType"];
    NSLog(@"====%@",param);
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    [HttpRequest requestData:@"Common/AdvancedFilterList" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            
            NSLog(@"====－－－－－－－%@",severDataDict.dataDict);
            
            
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                
                NSMutableArray* arrr=[[NSMutableArray alloc]init];
                
                arrr=[severDataDict.dataDict objectForKey:@"DataLine"];
                
                for (NSDictionary* dicc in arrr )
                {
                    [typeName addObject:[dicc valueForKey:@"typeName"]];
                    [typeCode addObject:[dicc valueForKey:@"typeCode"]];
                    [items addObject:[dicc valueForKey:@"items"]];
                    [isSingle addObject:[dicc valueForKey:@"isSingle"]];
                    
                    [congzhicurrent addObject:[dicc valueForKey:@"current"]];
                    [current addObject:[dicc valueForKey:@"current"]];
                    [dataType addObject:[dicc valueForKey:@"dataType"]];
                    
                    //                    for (NSDictionary* dicc1 in items )
                    //                    {
                    //                        [itemName addObject:[dicc1 valueForKey:@"itemName"]];
                    //                        [itemValue addObject:[dicc1 valueForKey:@"itemValue"]];
                    //
                    //                    }
                    //
                    
                }
                
                
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                [Global showTextHudSub:requestResultStr view:self.view];
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    
}
-(void)add{
    
    
    pageNumber = 1;
    
    
    
    
    commdity=[HAODEsingleton shared];
    
    
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    [param setValue:@"1" forKey:@"pageIndex"];
    [param setValue:@"20" forKey:@"pageSize"];
    [param setValue:_orderSort forKey:@"whsOutSort"];
    [param setValue:self.sats forKey:@"whsOutField"];
    [param setValue:searchBeans forKey:@"searchBeans"];
    
    [HttpRequest requestData:@"Business/WhsOut/List" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            
            NSLog(@"====%@",severDataDict.dataDict);
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                if (searchBeans.count>0) {
                    
                    UIImage *img=[UIImage imageNamed:@"shaixuan_hight"];
                UIImage *tinted = [img rt_tintedImageWithColor:luseColor];
                [shaixuanBtn setTitleColor:luseColor forState:UIControlStateNormal];
                [sxBtn setImage:tinted forState:UIControlStateNormal];
                    
                    
                }else{
                    [shaixuanBtn setTitleColor:shenhuicolor forState:UIControlStateNormal];
                    [sxBtn setImage:[UIImage imageNamed:@"shaixuan"] forState:UIControlStateNormal];
                }
                
                NSMutableArray* arrr=[[NSMutableArray alloc]init];
                
                arrr=[severDataDict.dataDict objectForKey:@"DataLine"];
                TotalCount=[severDataDict.dataDict objectForKey:@"TotalCount"];
                
                createName= [[NSMutableArray alloc] init];
                itemTypes= [[NSMutableArray alloc] init];
                whsOutDate= [[NSMutableArray alloc] init];
                whsOutId= [[NSMutableArray alloc] init];
                whsOutNo= [[NSMutableArray alloc] init];
                whsOutStatus= [[NSMutableArray alloc] init];
                whsOutTypeName= [[NSMutableArray alloc] init];
                whsOutTypeCode = [[NSMutableArray alloc] init];
                whsOutStatusName = [[NSMutableArray alloc] init];
                totalMoney = [[NSMutableArray alloc] init];
                totalQuantity = [[NSMutableArray alloc] init];
                whsName= [[NSMutableArray alloc] init];
                for (NSDictionary* dicc in arrr )
                {
                    [createName addObject:[dicc valueForKey:@"createName"]];
                    [itemTypes addObject:[dicc valueForKey:@"itemTypes"]];
                    [whsOutDate addObject:[dicc valueForKey:@"whsOutDate"]];
                    [whsOutId addObject:[dicc valueForKey:@"whsOutId"]];
                    [whsOutNo addObject:[dicc valueForKey:@"whsOutNo"]];
                    [whsOutStatus addObject:[dicc valueForKey:@"whsOutStatus"]];
                    [whsOutTypeName addObject:[dicc valueForKey:@"whsOutTypeName"]];
                    [whsOutTypeCode addObject:[dicc valueForKey:@"whsOutTypeCode"]];
                    [whsOutStatusName addObject:[dicc valueForKey:@"whsOutStatusName"]];
                    [totalMoney addObject:[dicc valueForKey:@"totalMoney"]];
                    [totalQuantity addObject:[dicc valueForKey:@"totalQuantity"]];
                    [whsName addObject:[dicc valueForKey:@"whsName"]];
                }
                [_table reloadData];
                
                
                
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==9999) {
                    
                    
                    TheLoginViewController *detailViewController = [[TheLoginViewController alloc] init];
                    [self.navigationController pushViewController:detailViewController animated:YES];
                }
                
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    
    
    
}

-(void)sat:(UIButton*)sender{
    [sat1 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [sat setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    searchBeans=nil;
    self.sats=@"newShelf";
    [self add];
}
-(void)sat1:(UIButton*)sender{
    saveAccount=!saveAccount;
    if (saveAccount) {
        
        self.sats=@"amount";
        
        _orderSort=@"asc";
        [self add];
        [sat setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        [sat1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [jiantouNormal setImage:[UIImage imageNamed:@"shang_hight"] forState:UIControlStateNormal];
        
    }else{
        
        self.sats=@"amount";
        _orderSort=@"desc";
        
        [self add];
        [sat setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        [sat1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [jiantouNormal setImage:[UIImage imageNamed:@"xia_hight"] forState:UIControlStateNormal];
        
    }
}


//下拉刷新
- (void)addheader
{
    
    //
    
    
    
    MJRefreshHeaderView* footer = [MJRefreshHeaderView header];
    footer.scrollView = _table;
    footer.beginRefreshingBlock = ^(MJRefreshBaseView* refreshView)
    {
        searchBeans=nil;
        self.sats=@"newShelf";
        commdity.content3=@"";
        
        [self add];
        
        
        [self performSelector:@selector(doneWithView:) withObject:refreshView afterDelay:3.0f];
        NSLog(@"%@--->正在刷新", refreshView.class);
    };
}



//上拉刷新
- (void)addFooter
{
    
    
    MJRefreshFooterView* footer = [MJRefreshFooterView footer];
    footer.scrollView = _table;
    footer.beginRefreshingBlock = ^(MJRefreshBaseView* refreshView)
    {
        
        
        
        
        
        NSLog(@"---------%d",pageNumber);
        NSLog(@"++++%d",TotalCount.intValue/5);
        
        
        if (TotalCount.intValue/20>=pageNumber) {
            pageNumber++;
            NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
            NSString* Token = [user objectForKey:@"tokenId"];
            if (Token ==nil) {
                Token=@"dd";
            }
            NSMutableDictionary *param = [NSMutableDictionary new];
            [param setValue:Token forKey:@"tokenId"];
            [param setValue:[NSString stringWithFormat:@"%d" ,pageNumber] forKey:@"pageIndex"];
            [param setValue:@"20" forKey:@"pageSize"];
            [param setValue:_orderSort forKey:@"whsOutSort"];
            [param setValue:self.sats forKey:@"whsOutField"];
            [param setValue:searchBeans forKey:@"searchBeans"];
            
            [HttpRequest requestData:@"Business/Shelf/List" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
                if (isSuccess) {
                    
                    NSLog(@"====%@",severDataDict.dataDict);
                    if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                        [Global hideProgressHUDInternal:self.view];
                        
                        NSMutableArray* arrr=[[NSMutableArray alloc]init];
                        
                        arrr=[severDataDict.dataDict objectForKey:@"DataLine"];
                        
                        
                        for (NSDictionary* dicc in arrr )
                        {
                            [createName addObject:[dicc valueForKey:@"createName"]];
                            [itemTypes addObject:[dicc valueForKey:@"itemTypes"]];
                            [whsOutDate addObject:[dicc valueForKey:@"whsOutDate"]];
                            [whsOutId addObject:[dicc valueForKey:@"whsOutId"]];
                            [whsOutNo addObject:[dicc valueForKey:@"whsOutNo"]];
                            [whsOutStatus addObject:[dicc valueForKey:@"whsOutStatus"]];
                            [whsOutTypeName addObject:[dicc valueForKey:@"whsOutTypeName"]];
                            [whsOutTypeCode addObject:[dicc valueForKey:@"whsOutTypeCode"]];
                            [whsOutStatusName addObject:[dicc valueForKey:@"whsOutStatusName"]];
                            [totalMoney addObject:[dicc valueForKey:@"totalMoney"]];
                            [totalQuantity addObject:[dicc valueForKey:@"totalQuantity"]];
                            [whsName addObject:[dicc valueForKey:@"whsName"]];
                            
                        }
                        [_table reloadData];
                        
                        
                        
                        
                    }else{
                        [Global hideProgressHUDInternal:self.view];
                        if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==9999) {
                            
                            
                            TheLoginViewController *detailViewController = [[TheLoginViewController alloc] init];
                            [self.navigationController pushViewController:detailViewController animated:YES];
                        }
                        
                    }
                    
                }
                else
                {
                    [Global hideProgressHUDInternal:self.view];
                    
                    [Global showTextHudSub:@"连接失败" view:self.view];
                }
                
            }];
            
            
        }else{
            
            NSString *requestResultStr=@"没有更多数据了！";
            // [Global showTextHud:requestResultStr view:self.view];
            [Global showTextHudSub:requestResultStr view:self.view];
            
            
        }
        
        
        
        
        
        
        [self performSelector:@selector(doneWithView:) withObject:refreshView afterDelay:3.0f];
        NSLog(@"%@--->正在刷新", refreshView.class);
    };
}
- (void)doneWithView:(MJRefreshBaseView *)refreshView
{
    [_table reloadData];
    [refreshView endRefreshing];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    if (tableView == table_list) {
        return [typeCode count];
    }
    if (tableView == biaoqiantable_list) {
        return [biaoqianarrrss count];
    }
    return [whsOutId count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    orderListCell* cell = (orderListCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        NSArray* nib = [[NSBundle mainBundle] loadNibNamed:@"orderListCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    UIButton*jiantou = [[UIButton alloc]init];
    jiantou.frame = CGRectMake(0,0, 8, 13);
    [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
    
    //    cell.accessoryView = jiantou;
    if (tableView == _table) {
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        NSString *s21 = [NSString stringWithFormat:@"%@",  [whsOutNo objectAtIndex:indexPath.row]];
        UIFont *font21 = [UIFont systemFontOfSize:titleNemberfot];
        CGSize size21 = CGSizeMake(ScreenWidth-30, 2000);
        CGSize labelsize21 = [s21 sizeWithFont:font21 constrainedToSize:size21 lineBreakMode:NSLineBreakByCharWrapping];
        cell.DocNum.text =[NSString stringWithFormat:@"%@ ",  s21];
        
        cell.DocNum.textColor=[UIColor blackColor];
        cell.DocNum.frame=CGRectMake(15,25, labelsize21.width+5,titleNemberfot);
        cell.DocNum.font= [UIFont systemFontOfSize: titleNemberfot],
        cell.orderId=[whsOutId objectAtIndex:indexPath.row];
        
        
        [cell.DocStatus.layer setCornerRadius:0];
        cell.DocStatus.frame=CGRectMake(cell.DocNum.right, 27, 170, Statusfot);
        
        cell.DocStatus.font=[UIFont systemFontOfSize:Statusfot];
        //        cell.DocStatus.textAlignment=NSTextAlignmentCenter;
        cell.DocStatus.textColor=luseColor;
        cell.DocStatus.text=[NSString stringWithFormat:@"%@",  [whsOutTypeName objectAtIndex:indexPath.row]];
        if ([[whsOutTypeName objectAtIndex:indexPath.row] isEqualToString:@"调拨出库"]) {
            cell.DocStatus.textColor=luseColor;
            cell.DocStatus.text=[NSString stringWithFormat:@"%@",  @"调拨出库"];
        }if ([[whsOutTypeName objectAtIndex:indexPath.row] isEqualToString:@"其他出库"]) {
            cell.DocStatus.textColor=shenhongsecolor;
            cell.DocStatus.text=[NSString stringWithFormat:@"%@",  @"其他出库"];
        }
        
        
        NSString *twos = [NSString stringWithFormat:@"%@", @"两个"];
        UIFont *twofont = [UIFont systemFontOfSize:contenfot];
        CGSize twosize = CGSizeMake(320, 2000);
        CGSize twolabelsize = [twos sizeWithFont:twofont constrainedToSize:twosize lineBreakMode:NSLineBreakByCharWrapping];

        
        
        cell.MemberCode.text=[NSString stringWithFormat:@"%@", @"员工"];
        cell.MemberCode.font=[UIFont systemFontOfSize:contenfot];
        cell.MemberCode.textColor=zhonghuiColor;
        cell.MemberCode.frame=CGRectMake(15,  cell.DocNum.bottom+15,  twolabelsize.width+5, contenfot);
        
        cell.huiyuansat=[createName objectAtIndex:indexPath.row];
        NSString *s12 = [NSString stringWithFormat:@"%@",  [createName objectAtIndex:indexPath.row]];
        UIFont *font12 = [UIFont systemFontOfSize:contenfot];
        CGSize size12 = CGSizeMake(320, 2000);
        CGSize labelsize12 = [s12 sizeWithFont:font12 constrainedToSize:size12 lineBreakMode:NSLineBreakByCharWrapping];
        if ([[NSString stringWithFormat:@"%@",   [createName objectAtIndex:indexPath.row]] isEqualToString:@""]) {
            cell.MemberCode1.text=@"未填写";
        }else{
            cell.MemberCode1.text=[NSString stringWithFormat:@"%@", [createName objectAtIndex:indexPath.row]];
        }
        cell.MemberCode1.font=[UIFont systemFontOfSize:contenfot];
        cell.MemberCode1.textColor=shenhuicolor;
        cell.MemberCode1.frame=CGRectMake(cell.MemberCode.right,  cell.DocNum.bottom+15,  labelsize12.width+5, contenfot);
        
        cell.GuideCode.text=[NSString stringWithFormat:@"%@", @"仓库"];
        cell.GuideCode.font=[UIFont systemFontOfSize:contenfot];
        cell.GuideCode.textColor=zhonghuiColor;
        cell.GuideCode.frame=CGRectMake(cell.MemberCode1.right+10,   cell.DocNum.bottom+15,  twolabelsize.width+5, contenfot);
        NSString *whsNames12 = [NSString stringWithFormat:@"%@",  [whsName objectAtIndex:indexPath.row]];
        UIFont *whsNamefont12 = [UIFont systemFontOfSize:contenfot];
        CGSize whsNamesize12 = CGSizeMake(320, 2000);
        CGSize whsNamelabelsize12 = [whsNames12 sizeWithFont:whsNamefont12 constrainedToSize:whsNamesize12 lineBreakMode:NSLineBreakByCharWrapping];
        cell.GuideCode1.text=[NSString stringWithFormat:@"%@", [whsName objectAtIndex:indexPath.row]];
        cell.GuideCode1.font=[UIFont systemFontOfSize:contenfot];
        cell.GuideCode1.textColor=shenhuicolor;
        cell.GuideCode1.frame=CGRectMake(cell.GuideCode.right,   cell.DocNum.bottom+15,  whsNamelabelsize12.width+5, contenfot);
        
        
        NSRange range={0,10};
        NSString* string =[[whsOutDate objectAtIndex:indexPath.row] substringWithRange:range];
        cell.DocDate.text=[NSString stringWithFormat:@"日期 %@", string];
        cell.DocDate.font=[UIFont systemFontOfSize:contenfot];
        cell.DocDate.textColor=zhonghuiColor;
        cell.DocDate.frame=CGRectMake(cell.GuideCode1.right+10,   cell.DocNum.bottom+15,  280*ScreenWidth/750,contenfot);
        
        cell.ItemName.text=[NSString stringWithFormat:@"%@", @"入库商品"];
        cell.ItemName.font=[UIFont systemFontOfSize:contenfot];
        cell.ItemName.textColor=zhonghuiColor;
        cell.ItemName.frame=CGRectMake(15,   cell.DocDate.bottom+5,   twolabelsize.width*2+5, contenfot);
        
        NSString *s2 = [NSString stringWithFormat:@"%@ 共%@件", [itemTypes objectAtIndex:indexPath.row], [totalQuantity objectAtIndex:indexPath.row]];
        
        UIFont *font2 = [UIFont systemFontOfSize:contenfot];
        CGSize size2 = CGSizeMake(320, 2000);
        CGSize labelsize2 = [s2 sizeWithFont:font2 constrainedToSize:size2 lineBreakMode:NSLineBreakByCharWrapping];
        
        
        cell.ItemName1.text=[NSString stringWithFormat:@"%@ 共%@件", [itemTypes objectAtIndex:indexPath.row], [totalQuantity objectAtIndex:indexPath.row]];
        cell.ItemName1.font=[UIFont systemFontOfSize:contenfot];
        cell.ItemName1.textColor=shenhuicolor;
        cell.ItemName1.frame=CGRectMake(cell.ItemName.right, cell.DocDate.bottom+5, labelsize2.width, contenfot);
        
        
        
        cell.DocTotal.text=[NSString stringWithFormat:@"%@", @"金额 ¥"];
        cell.DocTotal.font=[UIFont systemFontOfSize:contenfot];
        cell.DocTotal.textColor=zhonghuiColor;
        cell.DocTotal.frame=CGRectMake(cell.ItemName1.right+15,   cell.DocDate.bottom+5,   twolabelsize.width/2*3+2.5, contenfot);
        
        
        NSString*GoldPrice11=[NSString stringWithFormat:@"%@",[totalMoney objectAtIndex:indexPath.row]];
        NSNumberFormatter *numberFormatter11 = [[NSNumberFormatter alloc] init];
        [numberFormatter11 setPositiveFormat:@"###,##0.00;"];
        NSString *formattedNumberString11 = [numberFormatter11 stringFromNumber:[NSNumber numberWithDouble:GoldPrice11.floatValue]];
        
        NSString *s = [NSString stringWithFormat:@"%@", formattedNumberString11];
        UIFont *font = [UIFont systemFontOfSize:contenfot];
        CGSize size = CGSizeMake(320, 2000);
        CGSize labelsize = [s sizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByCharWrapping];
        
        cell.DocTotal1.text=[NSString stringWithFormat:@"%@", formattedNumberString11];
        cell.DocTotal1.font=[UIFont systemFontOfSize:contenfot];
        cell.DocTotal1.textColor=[UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1];
        cell.DocTotal1.frame=CGRectMake(cell.DocTotal.right,  cell.DocDate.bottom+5, labelsize.width+3, contenfot);
        
        
        
        
        
        
        if (whsOutDate.count !=indexPath.row+1) {
            UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 108-0.35, ScreenWidth-30, 0.35)];
            lineLabel1.backgroundColor=qianhuicolor;
            [cell.contentView addSubview:lineLabel1];
            
        }
        
        if (whsOutDate.count ==indexPath.row+1) {
            UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(0, 108-0.35, ScreenWidth, 0.35)];
            lineLabel1.backgroundColor=qianhuicolor;
            [cell.contentView addSubview:lineLabel1];
            
        }
        
        
    }
    
    
    if (tableView == biaoqiantable_list) {
        
        
        cell = [[orderListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ;
         cell.detailTextLabel.font=[UIFont systemFontOfSize:15];
        cell.textLabel.font=[UIFont systemFontOfSize:16];
        cell.textLabel.textColor=qianheicolor;
        cell.textLabel.text =[biaoqianarrrss objectAtIndex:indexPath.row];
        cell.saveAccount=YES;
        cell.xuanzeimage=[[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth-60-30, 17.5, 18, 18)];
        
        if  ([selectitemNameArray containsObject:[biaoqianarrrss objectAtIndex:indexPath.row]]){
            
            
            cell.xuanzeimage.image=[UIImage imageNamed:@"huiyuan_gou"];
            cell.saveAccount=NO;
            
        }
        
        
        [cell.contentView addSubview:cell.xuanzeimage];
        
        
        
        if (biaoqianarrrss.count !=indexPath.row+1) {
            UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 55-0.35, ScreenWidth-30-45, 0.3)];
            lineLabel1.backgroundColor=qianhuicolor;
            [cell.contentView addSubview:lineLabel1];
            
        }
        
        if (biaoqianarrrss.count ==indexPath.row+1) {
           UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 55-0.35, ScreenWidth-30-45, 0.3)];
            lineLabel1.backgroundColor=qianhuicolor;
            [cell.contentView addSubview:lineLabel1];
            
        }
        
    }
    
    
    
    
    
    
    //////////////////////////////////22222222222
    if (tableView == table_list) {
         cell.detailTextLabel.font=[UIFont systemFontOfSize:15];
        cell.textLabel.font=[UIFont systemFontOfSize:16];
        cell.textLabel.textColor=qianheicolor;
        if(commdity.content3.length> 0)
            
        {
            
            
            
            if  ([[typeName objectAtIndex:indexPath.row]isEqualToString:commdity.content2]){
                
                
                
                
                if (![commdity.content3 isEqualToString:@"自定义"]) {
                    cell.detailTextLabel.text =commdity.content3;
                    
                    for (int i = 0; i<[[items objectAtIndex:indexPath.row]count]; i++) {
                        
                        if  ([[[[items objectAtIndex:indexPath.row]objectAtIndex:i]objectForKey:@"itemName"] isEqualToString:commdity.content3]){
                            
                            [current replaceObjectAtIndex:indexPath.row withObject:[[items objectAtIndex:indexPath.row]objectAtIndex:i]];
                            
                        }else{
                            
                        }
                        
                    }
                    
                    
                }else{
                    
                    cell.detailTextLabel.text =[NSString stringWithFormat:@"%@~%@",openTimeTextFied.text,closeTimeTextFied.text];
                    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
                    
                    [dic setValue:[NSString stringWithFormat:@"%@",@"Y"]forKey:@"isCustom"];
                    [dic setValue:[NSString stringWithFormat:@"%@",@"Y"] forKey:@"isRange"];
                    [dic setValue:[NSString stringWithFormat:@"%@",@"自定义"] forKey:@"itemName"];
                    [dic setValue:[NSString stringWithFormat:@"%@",@"other"] forKey:@"itemValue"];
                    [dic setValue:openTimeTextFied.text forKey:@"minValue"];
                    [dic setValue:closeTimeTextFied.text forKey:@"maxValue"];
                    
                    [current replaceObjectAtIndex:indexPath.row withObject:dic];
                    
                    
                }
                
                
                
            }else{
                
                if ([[typeName objectAtIndex:indexPath.row]isEqualToString:@"类型"]) {
                    
                    
                    if ([baioqianshuju isEqualToString:@"youshuju"]) {
                        
                        
                        NSString*  string=[[NSString alloc]init];
                        
                        for(int i = 0; i < selectitemNameArray.count; i++){
                            string = [string stringByAppendingString:[NSString stringWithFormat:@"%@ ",  selectitemNameArray[i]]];
                            
                        }
                        cell.detailTextLabel.text = string;
                    }else{
                        //                        cell.detailTextLabel.text = [[congzhicurrent objectAtIndex:indexPath.row]objectForKey:@"itemName"];
                    }
                    
                }else{
                    
                    
                    //                    cell.detailTextLabel.text = [[congzhicurrent objectAtIndex:indexPath.row]objectForKey:@"itemName"];
                }
                
                
            }
            
            
            
        }else{
            
            
            cell = [[orderListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] ;
            cell.detailTextLabel.font=[UIFont systemFontOfSize:15];
            cell.textLabel.font=[UIFont systemFontOfSize:16];
            cell.textLabel.text = [typeName objectAtIndex:indexPath.row];
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            
            
            
            if ([[typeName objectAtIndex:indexPath.row] isEqualToString:@"类型"]) {
                
                if ([baioqianshuju isEqualToString:@"youshuju"]) {
                    
                    
                    NSString*  string=[[NSString alloc]init];
                    
                    for(int i = 0; i < selectitemNameArray.count; i++){
                        string = [string stringByAppendingString:[NSString stringWithFormat:@"%@ ",  selectitemNameArray[i]]];
                        
                    }
                    cell.detailTextLabel.text = string;
                }else{
                    cell.detailTextLabel.text = [[congzhicurrent objectAtIndex:indexPath.row]objectForKey:@"itemName"];
                }
                
            }else{
                
                
                cell.detailTextLabel.text = [[congzhicurrent objectAtIndex:indexPath.row]objectForKey:@"itemName"];
            }
            
        }
        
        cell.detailTextLabel.textColor=luseColor;
        if (!saveAccount1) {
            if (typeName.count !=indexPath.row+1) {
                UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 55-0.3, ScreenWidth-30-45, 0.3)];
                lineLabel1.backgroundColor=qianhuicolor;
                [cell.contentView addSubview:lineLabel1];
                
            }
            if (typeName.count ==indexPath.row+1) {
                UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 55-0.3, ScreenWidth-30-45, 0.3)];
                lineLabel1.backgroundColor=qianhuicolor;
                [cell.contentView addSubview:lineLabel1];
                saveAccount1=YES;
                
            }}
        
    }
    return cell;
}



- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView == table_list) {
        return  55;
    }
    if (tableView == biaoqiantable_list) {
        return  55;
    }
    
    return  108;
    
}




#pragma mark - Table view delegate


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (tableView == table_list) {
        
        
        
        UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];
        
        if ([cell.textLabel.text isEqualToString:@"类型"]) {
            
            NSMutableArray*arrrss1=[[NSMutableArray alloc]init];
            
            biaoqianarrrss=[[NSMutableArray alloc]init];
            biaoqianitemValue=[[NSMutableArray alloc]init];
            arrrss1=[[items objectAtIndex:indexPath.row] mutableCopy];
            
            for (int i = 0; i<arrrss1.count; i++) {
                [biaoqianarrrss addObject:[[[items objectAtIndex:indexPath.row] objectAtIndex:i] objectForKey:@"itemName"]];
                [biaoqianitemValue addObject:[[[items objectAtIndex:indexPath.row] objectAtIndex:i] objectForKey:@"itemValue"]];
            }
            
            biaoqiantable_list = [[UITableView alloc]initWithFrame:CGRectMake(45, 0, ScreenWidth-45, ScreenHeight) style:UITableViewStylePlain];
            biaoqiantable_list.delegate = self;
            biaoqiantable_list.dataSource = self;
            biaoqiantable_list.rowHeight = 60;
            biaoqiantable_list.separatorStyle=UITableViewCellSeparatorStyleNone;
            [self.window addSubview:biaoqiantable_list];
            
            
            UIView*Header=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth-50, NavHeight)];
            Header.backgroundColor=[UIColor whiteColor];
            biaoqiantable_list.tableHeaderView=Header;
            UILabel*line=[[UILabel alloc]initWithFrame:CGRectMake(0, NavHeight, ScreenWidth-50, 0.35)];
            line.backgroundColor=qianhuicolor;
            [Header addSubview:line];
            
            UILabel*title=[[UILabel alloc]initWithFrame:CGRectMake(0, 20, ScreenWidth-50, NavHeight-20)];
            title.text=@"类型";
            title.textAlignment=NSTextAlignmentCenter;
            [Header addSubview:title];
            
            UIButton*quxiao = [[UIButton alloc] initWithFrame:CGRectMake(5, 20, 50, NavHeight-20)];
            [quxiao setTitle:@"取消" forState:UIControlStateNormal];
            [quxiao setTitleColor:zhonghuiColor forState:UIControlStateNormal];
            quxiao.titleLabel.font=[UIFont systemFontOfSize:16];
            [quxiao addTarget:self action:@selector(biaoqianquxiao:) forControlEvents:UIControlEventTouchUpInside];
            [Header addSubview:quxiao];
            
            UIButton*chongzhi = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth-50-60, 20, 50, NavHeight-20)];
            [chongzhi setTitle:@"确认" forState:UIControlStateNormal];
            [chongzhi setTitleColor:luseColor forState:UIControlStateNormal];
            chongzhi.titleLabel.font=[UIFont systemFontOfSize:16];
            [chongzhi addTarget:self action:@selector(biaoqianqueren:) forControlEvents:UIControlEventTouchUpInside];
            [Header addSubview:chongzhi];
            
            
        }else{
            
            commdity.content2=typeName[indexPath.row];
            
            
            UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];
            [mainScroll removeFromSuperview];
            
            NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
            NSString* Token = [user objectForKey:@"Token"];
            if (Token ==nil) {
                Token=@"dd";
            }
            NSMutableDictionary *param = [NSMutableDictionary new];
            [param setValue:Token forKey:@"Token"];
            
            mainScroll = [[UIScrollView alloc]initWithFrame:CGRectMake(45, 0, ScreenWidth-45, ScreenHeight)];
            mainScroll.delegate = self;
            mainScroll.userInteractionEnabled = YES;
            mainScroll.scrollEnabled = YES;
            mainScroll.showsVerticalScrollIndicator = FALSE;
            mainScroll.showsHorizontalScrollIndicator = FALSE;
            mainScroll.backgroundColor=[UIColor whiteColor];
            [self.window addSubview:mainScroll];
            // 手势
            UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyBoad1)];
            singleFingerOne.numberOfTouchesRequired = 1; //手指数
            singleFingerOne.numberOfTapsRequired = 1; //tap次数
            singleFingerOne.delegate = self;
            [mainScroll addGestureRecognizer:singleFingerOne];
            UILabel*title=[[UILabel alloc]initWithFrame:CGRectMake(0, 20, ScreenWidth-50, NavHeight-20)];
            title.text=typeName[indexPath.row];
            title.textAlignment=NSTextAlignmentCenter;
            [mainScroll addSubview:title];
            
            UIButton*quxiao1 = [[UIButton alloc] initWithFrame:CGRectMake(5, 20, 50, NavHeight-20)];
            [quxiao1 setTitle:@"取消" forState:UIControlStateNormal];
            [quxiao1 setTitleColor:zhonghuiColor forState:UIControlStateNormal];
            quxiao1.titleLabel.font=[UIFont systemFontOfSize:16];
            [quxiao1 addTarget:self action:@selector(quxiao1:) forControlEvents:UIControlEventTouchUpInside];
            [mainScroll addSubview:quxiao1];
            UILabel*line=[[UILabel alloc]initWithFrame:CGRectMake(0, NavHeight-0.35, ScreenWidth-45, 0.35)];
            line.backgroundColor=qianhuicolor;
            [mainScroll addSubview:line];
            
            
            arrrss=[[NSMutableArray alloc]init];
            
            arrrss=[[items objectAtIndex:indexPath.row] mutableCopy];
            
            NSLog(@"%@",arrrss);
            if (arrrss.count>0) {
                
                for (int i = 0; i<arrrss.count; i++) {
                    
                    daogouView = [[sxview alloc]initWithFrame:CGRectMake(15, NavHeight+(55*i), ScreenWidth-45, 55)];
                    
                    daogouView.buttonView.titleLabel.textAlignment=NSTextAlignmentRight;
                    daogouView.buttonView.titleLabel.font=[UIFont systemFontOfSize:16];
                    daogouView.buttonView.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
                    [daogouView.buttonView setTitle: [[[items objectAtIndex:indexPath.row] objectAtIndex:i] objectForKey:@"itemName"] forState:UIControlStateNormal];
                    daogouView.buttonView.backgroundColor=[UIColor whiteColor];
                    daogouView.buttonView.tag=i;
                    [daogouView.buttonView setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
                    [daogouView.buttonView setTitleColor:shenhuicolor forState:0];
                    
                    
                    
                    [mainScroll addSubview:daogouView];
                    
                    if ([[[[items objectAtIndex:indexPath.row] objectAtIndex:i] objectForKey:@"itemName"] isEqualToString:@"自定义"]) {
                        
                        if ([typeName[indexPath.row] isEqualToString:@"时间"]) {
                            
                            [daogouView.buttonView setTitleColor:luseColor forState:0];
                            
                            UIButton*login = [[UIButton alloc] initWithFrame:CGRectMake(0, ScreenHeight-48, ScreenWidth-45, 48)];
                            [login setTitle:@"确认" forState:UIControlStateNormal];
                            [login setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
                            login.backgroundColor=luseColor;
                            [login addTarget:self action:@selector(queren:) forControlEvents:UIControlEventTouchUpInside];
                            [mainScroll addSubview:login];
                            
                            
                            
                            
                            _da = [[UIDatePicker alloc] init];
                            [_da addTarget:self action:@selector(dateChanged:) forControlEvents:UIControlEventValueChanged];
                            _da.datePickerMode = UIDatePickerModeDate;
                            _da.backgroundColor=[UIColor whiteColor];
                            
                            
                            openTimeTextFied=[[UITextField alloc]initWithFrame:CGRectMake(50,  daogouView.bottom-55, 110,  55)];
                            openTimeTextFied.borderStyle = UITextBorderStyleNone;
                            openTimeTextFied.font = [UIFont systemFontOfSize: contenfot];
                            openTimeTextFied.textColor=[UIColor blackColor];
                            openTimeTextFied.autocapitalizationType = UITextAutocapitalizationTypeSentences;
                            openTimeTextFied.tag=2;
                            openTimeTextFied.placeholder = @"开始时间"; //默认显示的字
                            openTimeTextFied.delegate = self;
                            openTimeTextFied.text=commdity.opentime;
                            openTimeTextFied.textAlignment=NSTextAlignmentCenter;
                            [openTimeTextFied setUserInteractionEnabled:YES];
                            //openTimeTextFied.clearButtonMode = UITextFieldViewModeWhileEditing;
                            [mainScroll addSubview:openTimeTextFied];
                            
                            UILabel* fuhao=[[UILabel alloc]initWithFrame:CGRectMake(openTimeTextFied.right, daogouView.bottom-55,15,55)];
                            fuhao.text=[NSString stringWithFormat:@"%@", @"～"];
                            fuhao.font=[UIFont systemFontOfSize:contenfot];
                            fuhao.textColor=[UIColor blackColor];
                            [mainScroll addSubview:fuhao];
                            
                            closeTimeTextFied=[[UITextField alloc]initWithFrame:CGRectMake(fuhao.right-5,  daogouView.bottom-55, 110,  55)];
                            closeTimeTextFied.borderStyle = UITextBorderStyleNone;
                            closeTimeTextFied.font = [UIFont systemFontOfSize: contenfot];
                            closeTimeTextFied.textColor=[UIColor blackColor];
                            closeTimeTextFied.autocapitalizationType = UITextAutocapitalizationTypeSentences;
                            closeTimeTextFied.tag=3;
                            closeTimeTextFied.placeholder = @"结束时间"; //默认显示的字
                            closeTimeTextFied.textAlignment=NSTextAlignmentCenter;
                            closeTimeTextFied.text= commdity.closeTime;
                            closeTimeTextFied.delegate = self;
                            [closeTimeTextFied setUserInteractionEnabled:YES];
                            //                                   closeTimeTextFied.clearButtonMode = UITextFieldViewModeWhileEditing;
                            [mainScroll addSubview:closeTimeTextFied];
                            //[_da setAccessibilityLanguage:@"Chinese"];
                            
                            openTimeTextFied.inputView = _da;
                            closeTimeTextFied.inputView = _da;
                            
                        }
                        
                        
                    }else{
                        [daogouView.buttonView addTarget:self action:@selector(daogouView:) forControlEvents:UIControlEventTouchUpInside];
                    }
                    
                    if ([[[[items objectAtIndex:indexPath.row] objectAtIndex:i] objectForKey:@"itemName"] isEqualToString:cell.detailTextLabel.text]) {
                        
                       UIImageView*image=[[UIImageView alloc]initWithFrame:CGRectMake(ScreenWidth-50-60, 16.5, 18, 18)];
                        image.image=[UIImage imageNamed:@"huiyuan_gou"];
                        
                        [daogouView addSubview:image];
                        
                    }
                }
                
                
                
                
                [mainScroll setContentSize:CGSizeMake(ScreenWidth-45, daogouView.bottom)];
            }
            
        }
        
        
        
    }
    if (tableView == _table) {
        commdity.orderId=whsOutId[indexPath.row];
        BusinessWhsOutDetailViewController *detailViewController = [[BusinessWhsOutDetailViewController alloc] init];
        detailViewController.titleName=@"出库详情";
        
        [self.navigationController pushViewController:detailViewController animated:YES];
        
        
        
        
    }
    if (tableView == biaoqiantable_list) {
        
        UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];
        orderListCell *sharecell=(orderListCell *)cell;
        sharecell.saveAccount=! sharecell.saveAccount;
        
        if (!sharecell.saveAccount) {
            
            [selectitemNameArray addObject:[NSString stringWithFormat:@"%@",[biaoqianarrrss objectAtIndex:indexPath.row]]];
            [selectitemValueArray addObject:[biaoqianitemValue objectAtIndex:indexPath.row]];
            
            [isCustom addObject:@"N"];
            [isRange addObject:@"N"];
            
            
            sharecell.xuanzeimage.image=[UIImage imageNamed:@"huiyuan_gou"];
            
        }
        else{
            UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];
            orderListCell *sharecell=(orderListCell *)cell;
            
            
            sharecell.xuanzeimage.image=[UIImage imageNamed:@""];
            
            
            if (selectitemNameArray.count>0) {
                
                for (int i=0; i<selectitemNameArray.count; i++) {
                    
                    NSString *codeStr = [selectitemNameArray objectAtIndex:i];
                    if ([codeStr isEqualToString:[NSString stringWithFormat:@"%@",[biaoqianarrrss objectAtIndex:indexPath.row]]] ) {
                        
                        [selectitemNameArray removeObjectAtIndex:i];//从指定索引移除
                        [selectitemValueArray removeObjectAtIndex:i];//从指定索引移除
                        [isCustom removeObjectAtIndex:i];//从指定索引移除
                        [isRange removeObjectAtIndex:i];//从指定索引移除
                    }
                }
            }
        }
        
        
    }
    
    
}







//确认多标签
-(void)biaoqianqueren:(UIButton*)sender{
    
    biaoqianxuanzhong=[[NSMutableArray alloc]init];
    
    for (int i=0; i<selectitemNameArray.count; i++) {
        NSMutableDictionary *dic = [NSMutableDictionary dictionary];
        NSString *itemName1 = [selectitemNameArray objectAtIndex:i];
        NSString *itemValue1 = [selectitemValueArray objectAtIndex:i];
        NSString *typeName1 = @"N";
        NSString *dataType1 = @"N";;
        
        [dic setValue:[NSString stringWithFormat:@"%@",itemName1]forKey:@"itemName"];
        [dic setValue:[NSString stringWithFormat:@"%@",itemValue1] forKey:@"itemValue"];
        [dic setValue:[NSString stringWithFormat:@"%@",typeName1] forKey:@"isCustom"];
        [dic setValue:[NSString stringWithFormat:@"%@",dataType1] forKey:@"isRange"];
        
        [biaoqianxuanzhong addObject:dic];
    }
    
    
    zhongzhisx=@"youshuju";
    baioqianshuju=@"youshuju";
    
    biaoqiantable_list.frame=CGRectMake(ScreenWidth, 0, ScreenWidth-50, ScreenHeight);
    
    [table_list reloadData];
    
}
//取消多标签为空
-(void)biaoqianquxiao:(UIButton*)sender{
    
    baioqianshuju=@"";
    
    selectitemNameArray=[[NSMutableArray alloc]init];
    selectitemValueArray=[[NSMutableArray alloc]init];
    isCustom=[[NSMutableArray alloc]init];
    isRange=[[NSMutableArray alloc]init];
    
    biaoqiantable_list.frame=CGRectMake(ScreenWidth, 0, ScreenWidth-50, ScreenHeight);
    [table_list reloadData];
    
    
    
}
//取消单个标签
-(void)quxiao1:(UIButton*)sender{
    [openTimeTextFied resignFirstResponder];
    [closeTimeTextFied resignFirstResponder];
    [mainScroll removeFromSuperview];
    
}

- (void)dateChanged:(id)sender
{
    
    UIDatePicker* picker = (UIDatePicker*)sender;
    NSDateFormatter* df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"yyyy-MM-dd"];
    
    
    
    
    if ([openTimeTextFied isFirstResponder])
    {
        openTimeTextFied.text = [NSString stringWithFormat:@"%@", [df stringFromDate:picker.date]];
        
        
        
    }else{
        
        closeTimeTextFied.text = [NSString stringWithFormat:@"%@", [df stringFromDate:picker.date]];
    }
    
    
}


-(void)queren:(UIButton*)sender{
    
    if ([ openTimeTextFied.text length] < 1)
    {
        [self showAlertMessage:@"请选择开始时间"];
    }
    else
    {
        
        if ([closeTimeTextFied.text length] <1)
        {
            [self showAlertMessage:@"请选择结束时间"];
        }
        else{
            
            
            [mainScroll removeFromSuperview];
            commdity.content3=@"自定义";
            [table_list reloadData];
            commdity.opentime=openTimeTextFied.text;
            commdity.closeTime=closeTimeTextFied.text;
        }}
    
    
}

-(void)daogouView:(UIButton*)sender{
    
    commdity.opentime=nil;
    commdity.closeTime=nil;
    
    commdity.content3=sender.titleLabel.text;
    [mainScroll removeFromSuperview];
    [table_list reloadData];
    
    
    
}


-(void)sxuan:(UIButton*)sender{
    
    
    if(commdity.content3.length> 0){
        
        
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 50, ScreenHeight)];
        view.backgroundColor=[UIColor blackColor];
        view.alpha=0.5;
        [self.window makeKeyAndVisible];
        [self.window addSubview:view];
        
        
        UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyBoad)];
        singleFingerOne.numberOfTouchesRequired = 1; //手指数
        singleFingerOne.numberOfTapsRequired = 1; //tap次数
        singleFingerOne.delegate = self;
        [view addGestureRecognizer:singleFingerOne];
        
        table_list.frame=CGRectMake(45, 0, ScreenWidth-45, ScreenHeight);
        [self.window addSubview:table_list];
        UIButton*login = [[UIButton alloc] initWithFrame:CGRectMake(45, ScreenHeight-48, ScreenWidth-45, 48)];
        [login setTitle:@"确认" forState:UIControlStateNormal];
        [login setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        login.backgroundColor=luseColor;
        [login addTarget:self action:@selector(querenleibie:) forControlEvents:UIControlEventTouchUpInside];
        [self.window addSubview:login];
        
        
    }else{
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 50, ScreenHeight)];
        view.backgroundColor=[UIColor blackColor];
        view.alpha=0.5;
        [self.window makeKeyAndVisible];
        [self.window addSubview:view];
        
        
        UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyBoad)];
        singleFingerOne.numberOfTouchesRequired = 1; //手指数
        singleFingerOne.numberOfTapsRequired = 1; //tap次数
        singleFingerOne.delegate = self;
        [view addGestureRecognizer:singleFingerOne];
        
        
         saveAccount1=NO;
        table_list = [[UITableView alloc]initWithFrame:CGRectMake(45, 0, ScreenWidth-45, ScreenHeight) style:UITableViewStylePlain];

        table_list.delegate = self;
        table_list.dataSource = self;
        table_list.rowHeight = 60;
        table_list.separatorStyle=UITableViewCellSeparatorStyleNone;
        [self.window addSubview:table_list];
        
        
        UIView*Header=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth-50, NavHeight)];
        Header.backgroundColor=[UIColor whiteColor];
        table_list.tableHeaderView=Header;
        UILabel*line=[[UILabel alloc]initWithFrame:CGRectMake(0, NavHeight, ScreenWidth-50, 0.35)];
        line.backgroundColor=qianhuicolor;
        [Header addSubview:line];
        
        UILabel*title=[[UILabel alloc]initWithFrame:CGRectMake(0, 20, ScreenWidth-50, NavHeight-20)];
        title.text=@"筛选";
        title.textAlignment=NSTextAlignmentCenter;
        [Header addSubview:title];
        
        UIButton*quxiao = [[UIButton alloc] initWithFrame:CGRectMake(5, 20, 50, NavHeight-20)];
        [quxiao setTitle:@"取消" forState:UIControlStateNormal];
        [quxiao setTitleColor:zhonghuiColor forState:UIControlStateNormal];
        quxiao.titleLabel.font=[UIFont systemFontOfSize:16];
        [quxiao addTarget:self action:@selector(quxiao:) forControlEvents:UIControlEventTouchUpInside];
        [Header addSubview:quxiao];
        
        UIButton*chongzhi = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth-50-60, 20, 50, NavHeight-20)];
        [chongzhi setTitle:@"重置" forState:UIControlStateNormal];
        [chongzhi setTitleColor:luseColor forState:UIControlStateNormal];
        chongzhi.titleLabel.font=[UIFont systemFontOfSize:16];
        [chongzhi addTarget:self action:@selector(chongzhi:) forControlEvents:UIControlEventTouchUpInside];
        [Header addSubview:chongzhi];
        
        UIButton*login = [[UIButton alloc] initWithFrame:CGRectMake(45, ScreenHeight-48, ScreenWidth-45, 48)];
        [login setTitle:@"确认" forState:UIControlStateNormal];
        [login setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        login.backgroundColor=luseColor;
        [login addTarget:self action:@selector(querenleibie:) forControlEvents:UIControlEventTouchUpInside];
        [self.window addSubview:login];
    }
}

-(void)chongzhi:(UIButton*)sender{
    searchBeans=nil;
    baioqianshuju=@"";
    [shaixuanBtn setTitleColor:shenhuicolor forState:UIControlStateNormal];
    [sxBtn setImage:[UIImage imageNamed:@"shaixuan"] forState:UIControlStateNormal];
    commdity.content3=@"";
    zhongzhisx=@"";
     saveAccount1=NO;
    current= [congzhicurrent mutableCopy];
    [table_list reloadData];
    
}
//取消筛选
-(void)quxiao:(UIButton*)sender{
    
    [openTimeTextFied resignFirstResponder];
    [closeTimeTextFied resignFirstResponder];
    [self.window makeKeyWindow ];
    self.window.hidden=YES;
    table_list.frame=CGRectMake(ScreenWidth, 0, ScreenWidth-45, ScreenHeight);
    
    
}
//确认筛选
-(void)querenleibie:(UIButton*)sender{
    
    [self.window makeKeyWindow ];
    self.window.hidden=YES;
    table_list.frame=CGRectMake(ScreenWidth, 0, ScreenWidth-45, ScreenHeight);
    
    searchBeans=[NSMutableArray array];
    
    for (int i=0; i<current.count; i++) {
        NSMutableDictionary *dic = [NSMutableDictionary dictionary];
        NSString *typeCode1 = [typeCode objectAtIndex:i];
        NSString *isSingle1 = [isSingle objectAtIndex:i];
        NSString *typeName1 = [typeName objectAtIndex:i];
        NSString *dataType1 = [dataType objectAtIndex:i];
        NSMutableArray* currentarray=[NSMutableArray array];
        [currentarray insertObject:[current objectAtIndex:i] atIndex:0];
        [dic setValue:[NSString stringWithFormat:@"%@",typeCode1]forKey:@"typeCode"];
        [dic setValue:[NSString stringWithFormat:@"%@",isSingle1] forKey:@"isSingle"];
        [dic setValue:[NSString stringWithFormat:@"%@",typeName1] forKey:@"typeName"];
        [dic setValue:[NSString stringWithFormat:@"%@",dataType1] forKey:@"dataType"];
        
        if ([typeName1 isEqualToString:@"类型"]) {
            
            
            if ([baioqianshuju isEqualToString:@"youshuju"]) {
                
                
                [dic setValue:biaoqianxuanzhong forKey:@"items"];
                
                
            }else{
                
                [dic setValue:currentarray forKey:@"items"];
                
            }
            
            
        }else{
            
            [dic setValue:currentarray forKey:@"items"];
            
        }
        
        [searchBeans addObject:dic];
    }
    
    //  NSLog(@"====%@",searchBeans);
    
    
    if ([zhongzhisx isEqualToString:@""]) {
        searchBeans=nil;//重置无数据
    }
    
    [self add];
    
    
}
-(void)closeKeyBoad1{
    [openTimeTextFied resignFirstResponder];
    [closeTimeTextFied resignFirstResponder];
}
-(void)closeKeyBoad{
    [openTimeTextFied resignFirstResponder];
    [closeTimeTextFied resignFirstResponder];
    [self.window makeKeyWindow ];
    self.window.hidden=YES;
    
    table_list.frame=CGRectMake(ScreenWidth, 0, ScreenWidth-45, ScreenHeight);
    saveAccount=YES;
    
    [searchTextField resignFirstResponder];
}





-(void)jiagemingxi:(UIButton*)sender{
    [i12 removeFromSuperview];
    [i22 removeFromSuperview];
    [i1 removeFromSuperview];
    
    
}
-(void)jiagemingxi1:(UIButton*)sender{
    
    [i12 removeFromSuperview];
    [i22 removeFromSuperview];
    [i1 removeFromSuperview];
    
    UIButton* button=(UIButton * )sender;
    orderListCell* cell=(orderListCell* )button.superview.superview;
    commdity.orderId=cell.orderId;
    commdity.orderStatus=cell.orderStatus;
    commdity.deliveryStatus=cell.deliveryStatus;
    commdity.installStatus=cell.installStatus;
    i22=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth*330/750, 0, ScreenWidth*140/750, 220*ScreenHeight/1334)];
    i22.backgroundColor=[UIColor colorWithRed:28/255.0 green:168/255.0 blue:172/255.0 alpha:1.0];
    [i22 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    i22.titleLabel.font=[UIFont systemFontOfSize:contenfot];
    [i22 addTarget:self action:@selector(bushouyin:) forControlEvents:UIControlEventTouchUpInside];
    [i22 setTitle:@"收银" forState:UIControlStateNormal];
    [cell addSubview:i22];
    
    
    
    i1=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth*470/750, 0,ScreenWidth*140/750, 220*ScreenHeight/1334)];
    i1.backgroundColor=[UIColor colorWithRed:90/255.0 green:130/255.0 blue:26/255.0 alpha:1.0];
    [i1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    i1.titleLabel.font=[UIFont systemFontOfSize:contenfot];
    [i1 addTarget:self action:@selector(peisongqueren:) forControlEvents:UIControlEventTouchUpInside];
    [i1 setTitle:@"配送确认" forState:UIControlStateNormal];
    [cell addSubview:i1];
    
    i12=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth*610/750, 0, ScreenWidth*140/750, 220*ScreenHeight/1334)];
    i12.backgroundColor=[UIColor colorWithRed:90/255.0 green:130/255.0 blue:26/255.0 alpha:1.0];
    [i12 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    i12.titleLabel.font=[UIFont systemFontOfSize:contenfot];
    [i12 addTarget:self action:@selector(anzhuangqueren:) forControlEvents:UIControlEventTouchUpInside];
    [i12 setTitle:@"安装确认" forState:UIControlStateNormal];
    [cell addSubview:i12];
    
}


-(void)peisongqueren:(UIButton*)sender{
    [i12 removeFromSuperview];
    [i22 removeFromSuperview];
    [i1 removeFromSuperview];
    if ([commdity.orderStatus isEqualToString:@"Y"]) {
        if ([commdity.deliveryStatus isEqualToString:@"Y"]) {
            [self showAlertMessage:@"此订单已经配送！"];
        }
        if ([commdity.deliveryStatus isEqualToString:@"X"]) {
            [self showAlertMessage:@"此订单无需配送！"];
        }
        if ([commdity.deliveryStatus isEqualToString:@"N"]) {
            
            
            DeliveryConfirmViewController  *generateVC=[[DeliveryConfirmViewController alloc] init];
            [self.navigationController pushViewController:generateVC animated:YES];
        }
        if ([commdity.deliveryStatus isEqualToString:@"B"]) {
            
            
            DeliveryConfirmViewController  *generateVC=[[DeliveryConfirmViewController alloc] init];
            [self.navigationController pushViewController:generateVC animated:YES];
        }
        
    }else{
        [self showAlertMessage:@"此订单未收全款！"];
    }
    
    
}
-(void)bushouyin:(UIButton*)sender{
    [i12 removeFromSuperview];
    [i22 removeFromSuperview];
    [i1 removeFromSuperview];
    
    [i12 removeFromSuperview];
    [i22 removeFromSuperview];
    [i1 removeFromSuperview];
    
    if ([commdity.orderStatus isEqualToString:@"Y"]) {
        [self showAlertMessage:@"此订单已经收款！"];
    }else{
        commdity.sat=@"bushouyin";
        
        ToResiduePayViewController  *generateVC=[[ToResiduePayViewController alloc] init];
        [self.navigationController pushViewController:generateVC animated:YES];
    }
    
    
    
}


-(void)anzhuangqueren:(UIButton*)sender{
    [i12 removeFromSuperview];
    [i22 removeFromSuperview];
    [i1 removeFromSuperview];
    NSLog(@"%@",commdity.installStatus);
    
    if ([commdity.orderStatus isEqualToString:@"Y"]) {
        
        if ([commdity.installStatus isEqualToString:@"Y"]) {
            [self showAlertMessage:@"此订单已经安装！"];
        }
        if ([commdity.installStatus isEqualToString:@"X"]) {
            [self showAlertMessage:@"此订单无需安装！"];
        }
        if ([commdity.installStatus isEqualToString:@"N"]) {
            
            
            InstallConfirmViewController  *generateVC=[[InstallConfirmViewController alloc] init];
            [self.navigationController pushViewController:generateVC animated:YES];
        }
        if ([commdity.installStatus isEqualToString:@"B"]) {
            
            
            InstallConfirmViewController  *generateVC=[[InstallConfirmViewController alloc] init];
            [self.navigationController pushViewController:generateVC animated:YES];
        }
        
    }else{
        
        
        [self showAlertMessage:@"此订单未收全款！"];
        
    }
    
    
}





-(void)sx:(UIButton*)sender{
    
    
    
    
    //    AdvancedFilterListViewController* store=[[AdvancedFilterListViewController alloc]init];
    //    store.delegate = self;
    //    commdity.FilterBusType=@"Order";
    //    [DataLineFileterParam removeAllObjects];
    //    [self.navigationController pushViewController:store animated:YES];
    //
}
#pragma mark  筛选后回调

//- (void)doSomethingAfterSelectDic:(NSDictionary *)dic{
//
//    if (dic ==nil) {
//        [DataLineFileterParam removeAllObjects];
//    }else{
//
//        NSString *FilterCode = [dic objectForKey:@"FilterCode"];
//        NSString *FilterName = [dic objectForKey:@"FilterName"];
//        NSString *FilterTypeCode = [dic objectForKey:@"FilterTypeCode"];
//        NSString *FilterTypeName = [dic objectForKey:@"FilterTypeName"];
//
//        NSLog(@"FilterCode:%@",FilterCode);
//        NSLog(@"FilterName:%@",FilterName);
//        NSLog(@"FilterTypeCode:%@",FilterTypeCode);
//        NSLog(@"FilterTypeName:%@",FilterTypeName);
//
//        for (int i=0; i<DataLineFileterParam.count; i++) {
//
//            NSString *codeStr = [[DataLineFileterParam objectAtIndex:i]objectForKey:@"FilterTypeName"];
//            if ([codeStr isEqualToString:FilterTypeName] ) {
//                [DataLineFileterParam removeObjectAtIndex:i];//从指定索引移除
//            }
//        }
//        [DataLineFileterParam addObject:dic];
//
//    }
//
//    NSLog(@"-----------FilterTypeName:%@",DataLineFileterParam);
//
//    //    [self showAlertMessage:[NSString stringWithFormat:@"选择了%@,%@,单号%@",FilterTypeName,FilterName,FilterCode]];
//}
//
- (void)showAlertWait
{
    alt = [[UIAlertView alloc] initWithTitle:@"网络不稳定 ！" message:@"请确认网络" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
    
}

- (void)showAlertMessage:(NSString *)msg
{
    alt = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
}
- (void)hideAlert
{
    if (alt != nil)
    {
        [alt dismissWithClickedButtonIndex:0 animated:YES];
        alt = nil;
    }
}

////上拉刷新
//- (void)addheader
//{
//    MJRefreshHeaderView* footer = [MJRefreshHeaderView header];
//    footer.scrollView = _table;
//    footer.beginRefreshingBlock = ^(MJRefreshBaseView* refreshView)
//    {
//
//        //        [Global hideProgressHUDInternal:mainScroll];
//
//
//        //这里的RefreshView就是footer
//        [self performSelector:@selector(doneWithView:) withObject:refreshView afterDelay:3.0f];
//        //        NSLog(@"%@--->正在刷新", mainScroll.class);
//    };
//
//}

-(void)jiazai1{
    [jiazai removeFromSuperview];
    
    
}
@end

